double f(int n, double a[], double x)
{
	double sum = 0.0;
	for (int i = 0; i <= n; i++)
	{
		sum += a[i] * pow(x, i);

		/*
		//pow(x, i)
		double power = 1.0;
		for (int j = 1; j <= i; j++)
		{
			power *= x;
		}
		sum += a[i] * power;
		*/
	}
	return sum;
}